let obj1 = {
    name: '张三',
    age: 20
}
let obj2 = obj1; // 没有实现拷贝
// 不是复印，引用传递 只是换个名字，还是一个东西
obj2.age = 99;

// let arr1 = [1, 2, 3];
// let arr2 = arr1;
// arr2.push(4);

// 怎么去实现数组对象的拷贝？
const arr = [1,2,3];
const newArr = [...arr];

let arr2 = arr.slice();
arr2[1] = 'b';
console.log(arr2,arr) // [ 1, 'b', 3 ] [ 1, 2, 3 ]

const arr3 = [[1,2],[3,4],[5,[6,7]]];
let arr4 = arr3.slice(); // 浅拷贝
arr4[2][1][1] = 8;
console.log(arr4, arr3) // [ [ 1, 2 ], [ 3, 4 ], [ 5, [ 6, 8 ] ] ] [ [ 1, 2 ], [ 3, 4 ], [ 5, [ 6, 8 ] ] ]
let arr5 = arr3.concat();